home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SCROLL.SWG / 0006_Quick Scroller.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  2KB  |  71 lines

  1. {
  2. BERNIE PALLEK
  3.  
  4. >Would anyone happen to know how I can use the ASCII Characters
  5. >while in Video mode $13 (320x200x256)? Or better yet, make a message
  6. >scroll across the screen like in them neat intros and demos..
  7.  
  8. The easiest way to do it is to set DirectVideo to False (if you are using
  9. the Crt Unit).  This disables direct Writes to the screen, meaning that
  10. the BIOS does screen writing, and the BIOS works in just about every
  11. screen mode.  Then, you can just use Write and WriteLn to display Text
  12. Characters (I think GotoXY will even work).  As For scrolling...
  13. Since mode 13h ($13) has linearly addressed video memory (just a run
  14. of 64,000 contiguous Bytes), do something like this:
  15.  
  16. this is untested, but it might actually work  :')
  17. }
  18.  
  19. Uses
  20.   Crt;
  21. Const
  22.   msgRow = 23;
  23.   waitTime = 1; { adjust suit your CPU speed }
  24.   myMessage : String = 'This is a test message.  It should be more ' +
  25.         'than 40 Characters long so the scrolling can be demonstrated.';
  26. Var
  27.   sx, xpos : Byte;
  28.  
  29. Procedure MoveCharsLeft;
  30. Var
  31.   curLine : Word;
  32. begin
  33.   { shift the row left 1 pixel }
  34.   For curLine := (msgRow * 8) to (msgRow * 8) + 7 DO
  35.     Move(Mem[$A000 : curLine * 320 + 1], Mem[$A000 : curLine * 320], 319);
  36.   { clear the trailing pixels }
  37.   For curLine := (msgRow * 8) to (msgRow * 8) + 7 DO
  38.     Mem[$A000 : curLine * 320 + 319] := 0;
  39. end;
  40.  
  41. begin
  42.   Asm
  43.     MOV AX, $13
  44.     INT $10
  45.   end;
  46.   DirectVideo := False;
  47.   GotoXY(1, msgRow + 1);
  48.   Write(Copy(myMessage, 1, 40));
  49.   { 'myMessage' must be a String With a Length > 40 }
  50.   For xpos := 41 to Length(myMessage) do
  51.   begin
  52.     For sx := 0 to 7 do
  53.     begin
  54.       MoveCharsLeft;
  55.       Delay(waitTime);
  56.     end;
  57.     GotoXY(40, msgRow + 1);
  58.     Write(myMessage[xpos]);
  59.   end;
  60.   Asm
  61.     MOV AX, $3
  62.     INT $10
  63.   end;
  64. end.
  65.  
  66. {
  67. This may not be very efficiently coded.  As well, it could benefit from
  68. an Assembler version.  But it should at least demonstrate a technique
  69. you can learn from.  }
  70.  
  71.